Can you do anything useful with the -cli command line switch?

The DOORS manual says that the -cli (or -C) command line swith can be used to run a DXL script during DOORS startup, prior to the splash screen. I have done some experimenting, and it appears there are quite a few limitiations to this, and so I am just curious what, if anything, can be accomplished with this.

For example,
1.) There is no GUI at this point, so any DB or DBE commands are out.
2.) You are not connected to the database at this point, so any commands for folders, projects, modules, database info, are all out.
3.) There is no "current user" at this point, so any commands related to user info are out.

I have found that some commands such as "query" and "messageBox" do work. So, although you could prompt the user with a simple message box, I am not sure what actions you could take from there, since you are not connected to the data yet.

I realize the -dxl (or -D) command line can be used to run a DXL script after the splash screen, and does not have these limitations.

I am just curious if anyone uses the -cli command line switch to do anything useful.
djakad - Wed Feb 03 11:17:32 EST 2010

Re: Can you do anything useful with the -cli command line switch?
Peter_Albert - Thu Feb 04 03:40:13 EST 2010

One thing you can do with the -cli command (and not with -dxl) is to set the "addins" and "ProjectAdding" Environment variables. If you want to show different menu entries (in the module explorer and module windows) to different users, then you can set up different folders in different locations on the network, and depending on the username() set the variables to one location or the other. Of course the usual limitations apply, i.e. all users must have a (fast) connection to the network, etc.

Peter

Re: Can you do anything useful with the -cli command line switch?
llandale - Thu Feb 04 15:06:41 EST 2010

Never used it, but it seems to me that you could make clever use of the 'evalTop_' command to insert variables and functions into the top context. You may want to do that if you want to override existing functions, like insert your own DB Explorer code.

Re: Can you do anything useful with the -cli command line switch?
SystemAdmin - Tue Jun 22 13:42:31 EDT 2010

Peter_Albert - Thu Feb 04 03:40:13 EST 2010
One thing you can do with the -cli command (and not with -dxl) is to set the "addins" and "ProjectAdding" Environment variables. If you want to show different menu entries (in the module explorer and module windows) to different users, then you can set up different folders in different locations on the network, and depending on the username() set the variables to one location or the other. Of course the usual limitations apply, i.e. all users must have a (fast) connection to the network, etc.

Peter

Peter, Do you have any examples on how to do the limitations for users? I have several scripts that are only administrative that I want to hide from other users that have no experience in administration. Please advise. Thanks

Re: Can you do anything useful with the -cli command line switch?
Peter_Albert - Wed Jun 23 03:55:24 EDT 2010

SystemAdmin - Tue Jun 22 13:42:31 EDT 2010
Peter, Do you have any examples on how to do the limitations for users? I have several scripts that are only administrative that I want to hide from other users that have no experience in administration. Please advise. Thanks

Well, it is not really a limitation, but rather a fork pointing different users' "addins" and "ProjectAddins" to different locations on the network. As a prerequisite, you must have different copies of your DXL folders at different locations, say at "Z:\DOORS\dxl\allUsers" and "Z:\DOORS\dxl\Admin". Assuming both have sub-folders "addins" and "projectAddins", then you can use

bool isAdmin
isAdmin = yourRoutineForSpecifyingWhoHasAdminRights(username())
if (isAdmin)
{
  setenv("addins", "Z:\\DOORS\\dxl\\Admin\\addins")
  setenv("ProjectAddins", "Z:\\DOORS\\dxl\\Admin\\projectAddins")
}
else
{
  setenv("addins", "Z:\\DOORS\\dxl\\allUsers\\addins")
  setenv("ProjectAddins", "Z:\\DOORS\\dxl\\allUsers\\projectAddins")
}

in a file you call with "-cli". (You could of course also use the -a and -J command line switches directly, but with the above approach it is easier to grant and remove "admin routines" to users when necessary).

As for the DXL folders, if you keep your administrative tools in a separate folder, then you can actually copy / paste all files to both the "allUsers" and the "Admin" subfolders. Simply renaming the .hlp file in the administrative folder in the "allUsers" area to ".hlp_" actually hides the routines from the users. Thus syncing thedifferent DXL structures is quite simple.

Regards,

Peter

Re: Can you do anything useful with the -cli command line switch?
Peter_Albert - Wed Jun 23 03:57:12 EDT 2010

Peter_Albert - Wed Jun 23 03:55:24 EDT 2010

Well, it is not really a limitation, but rather a fork pointing different users' "addins" and "ProjectAddins" to different locations on the network. As a prerequisite, you must have different copies of your DXL folders at different locations, say at "Z:\DOORS\dxl\allUsers" and "Z:\DOORS\dxl\Admin". Assuming both have sub-folders "addins" and "projectAddins", then you can use

bool isAdmin
isAdmin = yourRoutineForSpecifyingWhoHasAdminRights(username())
if (isAdmin)
{
  setenv("addins", "Z:\\DOORS\\dxl\\Admin\\addins")
  setenv("ProjectAddins", "Z:\\DOORS\\dxl\\Admin\\projectAddins")
}
else
{
  setenv("addins", "Z:\\DOORS\\dxl\\allUsers\\addins")
  setenv("ProjectAddins", "Z:\\DOORS\\dxl\\allUsers\\projectAddins")
}

in a file you call with "-cli". (You could of course also use the -a and -J command line switches directly, but with the above approach it is easier to grant and remove "admin routines" to users when necessary).

As for the DXL folders, if you keep your administrative tools in a separate folder, then you can actually copy / paste all files to both the "allUsers" and the "Admin" subfolders. Simply renaming the .hlp file in the administrative folder in the "allUsers" area to ".hlp_" actually hides the routines from the users. Thus syncing thedifferent DXL structures is quite simple.

Regards,

Peter

Ah, you can't use \* in a post without escaping it. Just using * without the \\ character effectively puts things in bold until the next *.

Re: Can you do anything useful with the -cli command line switch?
llandale - Wed Jun 23 16:52:52 EDT 2010

Peter_Albert - Wed Jun 23 03:55:24 EDT 2010

Well, it is not really a limitation, but rather a fork pointing different users' "addins" and "ProjectAddins" to different locations on the network. As a prerequisite, you must have different copies of your DXL folders at different locations, say at "Z:\DOORS\dxl\allUsers" and "Z:\DOORS\dxl\Admin". Assuming both have sub-folders "addins" and "projectAddins", then you can use

bool isAdmin
isAdmin = yourRoutineForSpecifyingWhoHasAdminRights(username())
if (isAdmin)
{
  setenv("addins", "Z:\\DOORS\\dxl\\Admin\\addins")
  setenv("ProjectAddins", "Z:\\DOORS\\dxl\\Admin\\projectAddins")
}
else
{
  setenv("addins", "Z:\\DOORS\\dxl\\allUsers\\addins")
  setenv("ProjectAddins", "Z:\\DOORS\\dxl\\allUsers\\projectAddins")
}

in a file you call with "-cli". (You could of course also use the -a and -J command line switches directly, but with the above approach it is easier to grant and remove "admin routines" to users when necessary).

As for the DXL folders, if you keep your administrative tools in a separate folder, then you can actually copy / paste all files to both the "allUsers" and the "Admin" subfolders. Simply renaming the .hlp file in the administrative folder in the "allUsers" area to ".hlp_" actually hides the routines from the users. Thus syncing thedifferent DXL structures is quite simple.

Regards,

Peter

Even though I posted in Feb, I seem to have missed this thread. Did I say that already?

It appears -cli code runs before the login screen so you cannot query on 'doorsName' but yes can query on 'username', which is the login user on the computer. I notice the 'setenv' actually change the environment variables in the Registry, wish it didn't do that.

I wonder if the -cli code that sets the addins could coordinate with a -dxl code that sets them back. Mmmmmmmm ... -cli copies the entries in question using the 'registry' commands; perhaps creating key value "addins_Original". Then sets it. -dxl looks for 'addins_Original' and if there, copies it to 'addins' and deletes it.

Perhaps I could ask them what Project they intend to do today, limiting the number of menus available to them

  • Louie